<script setup>
import { ref } from 'vue'
const count = ref(0)
const name = ref('Vue.js')
function greet(event) {
  alert(`Hello ${name.value}!`)
  // `event` 是 DOM 原生事件
  if (event) {
    alert(event.target.tagName)
  }
}

function onCtrlClick(event) {
    console.log('仅当按下 Ctrl 且未按任何其他键时才会触发'+event.target);
}

function submit() {
    console.log('submit');
}
</script>

<template>
    <div>
        <button @click="count++">内联事件</button>
        <p>Count is: {{ count }}</p>
    </div>
    <div>
        <button @click="greet">方法事件</button>
    </div>
    <input @keyup.enter="submit" />
    <!-- 仅当按下 Ctrl 且未按任何其他键时才会触发 -->
    <button @click.ctrl.exact="onCtrlClick">A</button>
</template>